from api.emp_insert_api import emp_insert
from api.login_api import ihrmLogin
import requests


class ihrm_emp_update:
    data = ihrmLogin.ihrm_login('13800000002', '123456').json()['data']
    @classmethod
    def emp_update(cls,mobile):
        dataID = emp_insert.ihrm_emp_insert('张大大33', mobile, '12343554').json()['data']['id']
        herderData = {"Content-Type": "application/json", "Authorization": cls.data}
        URL = 'http://ihrm2-test.itheima.net/api/sys/user/' + dataID
        jsonData ={"username":"张小花33"}
        resp = requests.put(url=URL,headers=herderData,json=jsonData)
        return resp

if __name__ == '__main__':
    resp = ihrm_emp_update.emp_update('13165437893')
    print(resp.json())